﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Oragon.Architecture.Data.QueryBuilder
{
	/// <summary>
	/// Provide acess to specific ILiteralBuilder
	/// </summary>
	/// <remarks>Use an IOC container to define your literal</remarks>
	public class LiteralManager
	{
		public LiteralManager()
		{
		}

		/// <summary>
		/// I'm using it for simplify this example. Use an IOC container or a implements this build métod for obtain best indirection and injection
		/// </summary>
		private static ILiteralBuilder literalBuilder;
		public static ILiteralBuilder GetLiteralBuilder(string connectionName)
		{
			if (LiteralManager.literalBuilder == null)
				LiteralManager.literalBuilder = new SqlServer.SQLServerLiteralBuilder();
			return LiteralManager.literalBuilder;
		}
		
		public static ILiteralBuilder GetLiteralBuilder()
		{
			return LiteralManager.GetLiteralBuilder(null);
		}

	}
}
